home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_stylesheets.idb / usr / freeware / bin / db2html.z / db2html
Encoding:
Text File  |  1999-07-21  |  1.8 KB  |  74 lines

  1. #! /bin/sh
  2.  
  3. DB_STYLESHEET=${ROOT}/usr/freeware/lib/sgml/stylesheets/cygnus-both.dsl
  4. HTML_STYLESHEET=${ROOT}/usr/freeware/lib/sgml/stylesheets/nwalsh-modular/test/docbook.css
  5. ADMON_GRAPHICS=${ROOT}/usr/freeware/lib/sgml/stylesheets/nwalsh-modular/images/*.gif
  6.  
  7. output=db2html-dir
  8. TMPDIR=DBTOHTML_OUTPUT_DIR$$
  9.  
  10. echo TMPDIR is $TMPDIR
  11.  
  12. if [ $# -gt 2 ]
  13. then
  14.   echo "Usage: `basename $0` [filename.sgml]" >&2
  15.   exit 1
  16. fi
  17.  
  18. if [ $# -eq 1 ]
  19. then
  20.   if [ ! -r $1 ]
  21.   then
  22.     echo Cannot read \"$1\".  Exiting. >&2
  23.     exit 1
  24.   fi
  25.   if echo $1 | egrep -i '\.sgml$|\.sgm$' >/dev/null 2>&1
  26.   then
  27.     # now make sure that the output directory is always a subdirectory
  28.     # of hte current directory
  29.     echo
  30.     input_file=`basename $1`
  31.     output="`echo $input_file | sed 's,\.sgml$,,;s,\.sgm$,,'`"
  32.     echo "input file was called $input_file -- output will be in $output"
  33.     echo
  34.   fi
  35. fi
  36.  
  37. # we used to generate a single file, but with the modular DB_STYLESHEETs
  38. # it's best to make a new directory with several html files in it
  39. #cat $* | jade -d $DB_STYLESHEET -t sgml -V nochunks > $TMPFN
  40.  
  41. mkdir $TMPDIR
  42. SAVE_PWD=`pwd`
  43. if [ $1 = `basename $1` ]; then
  44.   echo "working on ../$1"
  45.   (cd $TMPDIR; jade -t sgml -ihtml -d ${DB_STYLESHEET}\#html ../$1; cd $SAVE_PWD)
  46. else
  47.   echo "working on $1"
  48.   (cd $TMPDIR; jade -t sgml -ihtml -d ${DB_STYLESHEET}\#html $1; cd $SAVE_PWD)
  49. fi
  50.  
  51. if [ $# -eq 1 ]
  52. then
  53.   if [ -d ${output}.junk ]
  54.   then
  55.     /bin/rm -rf ${output}.junk
  56.   fi
  57.   if [ -d ${output} ]
  58.   then
  59.     mv $output ${output}.junk
  60.   fi
  61.   echo "about to copy cascading stylesheet and admon graphics to temp dir"
  62.   cp ${HTML_STYLESHEET} ${TMPDIR}/
  63.   mkdir ${TMPDIR}/stylesheet-images
  64.   cp ${ADMON_GRAPHICS} ${TMPDIR}/stylesheet-images
  65.   echo "about to rename temporary directory to $output"
  66.   mv ${TMPDIR} $output
  67. else
  68.   cat $TMPDIR/*
  69. fi
  70.  
  71. rm -rf $TMPDIR
  72.  
  73. exit 0
  74.